-
Notifications
You must be signed in to change notification settings - Fork 919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add defrag logic for zsets #3836
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: kostas <[email protected]>
Signed-off-by: kostas <[email protected]>
return realloced; | ||
} | ||
|
||
pair<sds, bool> ScoreMap::ReallocIfNeeded(void* obj, float ratio) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can extra this to seperate function. It's almost identical as to StringMap
... I will follow up on this on separate PR with a small refactor
|
||
for (auto it = score_map->begin(); it != score_map->end(); ++it) { | ||
realloced |= it.ReallocIfNeeded(ratio); | ||
// Not sure if it's worth going over B+ tree cause lgn to delete + lgn to insert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't think it's really worth going over the B+ tree because we would need to delete + insert. We can add this in the future if we wish to + it's really boilerplate....
@@ -142,4 +142,50 @@ detail::SdsScorePair ScoreMap::iterator::BreakToPair(void* obj) { | |||
return detail::SdsScorePair(f, GetValue(f)); | |||
} | |||
|
|||
bool ScoreMap::iterator::ReallocIfNeeded(float ratio) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also //todo for me, mock this and test for sanity
partially resolves #3822 [2/2]